home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
screen
/
entpass.frm
next >
Wrap
Text File
|
1994-11-28
|
4KB
|
149 lines
VERSION 2.00
Begin Form frmEnterPass
BorderStyle = 3 'Fixed Double
ClientHeight = 2265
ClientLeft = 1065
ClientTop = 1515
ClientWidth = 4095
ControlBox = 0 'False
Height = 2670
Left = 1005
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2265
ScaleWidth = 4095
Top = 1170
Width = 4215
Begin Timer Timer1
Enabled = 0 'False
Interval = 30000
Left = 2220
Top = 1680
End
Begin CommandButton cmdCancel
Cancel = -1 'True
Caption = "Cancel"
Height = 375
Left = 2820
TabIndex = 2
Top = 1740
Width = 1095
End
Begin CommandButton cmdOK
Caption = "OK"
Default = -1 'True
Height = 375
Left = 720
TabIndex = 1
Top = 1740
Width = 1095
End
Begin TextBox txtPassword
Height = 285
Left = 1860
MaxLength = 20
PasswordChar = "*"
TabIndex = 0
Top = 1260
Width = 2055
End
Begin Label Label2
Caption = "Password:"
Height = 195
Left = 720
TabIndex = 4
Top = 1320
Width = 975
End
Begin Label Label1
Caption = "The screen saver you are using is password protected. You must type in the screen saver password to turn off the screen saver."
Height = 855
Left = 720
TabIndex = 3
Top = 120
Width = 3255
End
Begin Image imgIcon
Height = 480
Left = 120
Picture = ENTPASS.FRX:0000
Top = 120
Width = 480
End
End
Option Explicit
Dim FirstTime As Integer
Sub cmdCancel_Click ()
ValidPassword = 2 ' Password canceled
Unload Me
End Sub
Sub cmdOK_Click ()
If CalcPassnum(UCase$(txtPassword.Text)) = Password Then
ValidPassword = 1 ' Password valid
Else
ValidPassword = 3 ' Password invalid
End If
Unload Me
End Sub
Sub Form_Activate ()
If FirstTime Then
FirstTime = False
txtPassword.SetFocus
End If
End Sub
Sub Form_Load ()
Dim i As Integer
FirstTime = True
Caption = SaverName
CentreForm Me
ValidPassword = 0 ' Set to a known value
timer1.Enabled = True ' Start the timer
' Set the Form to be TopMost
SetWindowPos Me.hWnd, -1, 0, 0, 0, 0, 3
' Set the Form to be System Modal (Ouch!)
i = SetSysModalWindow(hWnd)
End Sub
Sub Form_Unload (Cancel As Integer)
timer1.Enabled = False ' Cancel the timer explicitly
'
' If Alt-F4 or the control box is clicked then
' set ValidPassword to Canceled
'
If ValidPassword = 0 Then ValidPassword = 2
End Sub
Sub Timer1_Timer ()
'
' if we have had no activity for 30 seconds then
' let the screen saver get on with it.
'
Unload Me
End Sub
Sub txtPassword_KeyPress (KeyAscii As Integer)
'
' The user has typed something so reset the counter
' to 30 seconds and start counting again
'
timer1.Enabled = False
timer1.Interval = 30000
timer1.Enabled = True
End Sub